var mapIds = [993104000, 993104100];
var 准备地图 = 993104200;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("新复古_爬高高");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully()
    }
    c.setProperty("startTime", new Date().getTime() + 60 * 1000);
    c.schedule("入场", 60 * 1000);
    c.schedule("广播1", 10 * 1000);
    c.schedule("广播2", 20 * 1000);
    c.schedule("广播3", 30 * 1000);
    c.schedule("广播4", 40 * 1000);
    c.schedule("广播5", 50 * 1000);
    c.schedule("广播6", 56 * 1000);
    c.schedule("阶段检查", 1000);
    c.setProperty("portal1", c.rand(1, 3));
    c.setProperty("portal2", c.rand(1, 3));
    c.setProperty("portal3", c.rand(1, 3));
    return c
}

function 广播1(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.getAPI().getWeatherEffectNotice("开始的同时向上~向上~不断向上~向上~YO！", 287, 3500, 1)
    })
}

function 广播2(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.getAPI().getWeatherEffectNotice("什么都无法阻碍甘迪YO~", 287, 3500, 1)
    })
}

function 广播3(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.getAPI().getWeatherEffectNotice("躲避障碍物YO！顺着梯子爬上来YO！上来找甘迪吧YO！", 287, 3500, 1)
    })
}

function 广播4(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.getAPI().getWeatherEffectNotice("你想成为拯救新复古王国的勇士吗YO？那就不断向上~向上YO！", 287, 3500, 1)
    })
}

function 广播5(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.getAPI().getWeatherEffectNotice("向上~向上~修行可以将勇士变得强大YO~", 287, 3500, 1)
    })
}

function 广播6(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.getAPI().新复古_爬高高_倒计时(3, 0)
    })
}

function 入场(a) {
    a.getMapInstance(0).getCharacters().forEach(function (b) {
        b.changeMap(993104100, 5)
    });
    a.startEventTimer(300 * 1000)
}

function 阶段检查(a) {
    a.getMapInstance(1).getCharacters().forEach(function (b) {
        switch (b.getAPI().getNumberFromQuestInfo(100240, "progress")) {
            case 20:
                if (b.getPosition().y <= -620) {
                    b.getAPI().setNumberForQuestInfo(100240, "progress", 40);
                    b.getAPI().新复古_爬高高_设置完成率(40)
                }
                break;
            case 60:
                if (b.getPosition().y <= -3860) {
                    b.getAPI().setNumberForQuestInfo(100240, "progress", 80);
                    b.getAPI().新复古_爬高高_设置完成率(80)
                }
                break
        }
    });
    a.schedule("阶段检查", 1000)
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    a.getAPI().新复古_爬高高_倒计时(2, b.getNumberProperty("startTime") - new Date().getTime());
    b.showClockEffect(a, b.getNumberProperty("startTime") - new Date().getTime(), false)
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    em.setProperty("kill", "0");
    em.setProperty("level", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a);
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onMonsterDamaged(b, a, d, e, c) {}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        b.scheduleWarpTask(3, 993107701, 0, false)
    })
}

function onMonsterKilled(a, c, b) {}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function onItemPickedUp(b, a, c) {};